<?php
	require_once('IpbXmlRpcClient.php');
	
	$forum = new IpbXmlRpcClient('http://forum.host.tld', 'secret-key-from-forum-admin');
	$forum->setDebug(false);
	
	/* Getting topic replies */
	$r = $forum->fetchReplies(array(
		'tid'=>48497, //topic ID
		'limit'=>5
	));
	if($r === false){
		die( "Error: " . $forum->getLastError() );
	}
	printf("We have fetched %d results from specified topic.\n\n", count($r));
	unset($r);
	
	
	/* Posting a topic */	
	$tid = $forum->postTopic(array(
		'member_id'=>1, 
		'forum_id'=>117, 
		'topic_title'=>'Invision can XMLRPC', 
		'topic_description'=>'and it is true', 
		'post_content'=>'We have just added a new post trough it!'
	));
	if($tid === false){
		die( "Error: " . $forum->getLastError() );
	}
	printf("New topic's ID is %d\n\n", $tid);
	
	
	/* Posting a reply */
	$r = $forum->postReply(array(
		'guest_name'         => 'Foo',
		'topic_id'           => 12345, //Enter your tid (topic id) here (you can get $tid from prev example)
		'post_content'       => 'And this is a reply to our post!',
	));
	if($r === false){
		die( "Error: " . $forum->getLastError() );
	}else{
		print("Reply added!");
	}
	unset($r);	
		
		
	/* Fetching topic details */
	$r = $forum->fetchTopicInfo( array(
		'tid'=>$tid // We got topic id from previous example here
	) );
	if($r === false){
		die( "Error: " . $forum->getLastError() );
	}
	//print_r($r);
	unset($r);
	
?>
